<template>
  <view style="">
    <!-- 轮播图 -->
    <view class="" v-if="list.length != 0" style="margin-bottom: 34rpx;"><u-swiper height="888" :list="list"></u-swiper></view>
    <view class="shoop">
      <view class="shoop_son" v-for="(item, index) in shoopList" @click="toDetlis(item)" :key="index">
        <image :src="item.image" style="width: 330rpx;height: 400rpx;" mode=""></image>
        <view class="price">
          <view class="bt">标准被套 | 米白</view>
          <view class="btPrice">
            <view class="" style="color: #5C5A55;font-size: 28rpx;">￥{{ item.price }}</view>
            <!-- <view class="" style="color: #ADADAA;font-size: 24rpx;font-weight: 400;text-decoration: line-through;">￥1599</view> -->
          </view>
        </view>
      </view>
    </view>
    <view v-if="list.length == 0 && shoopList.length == 0" style="color: #ADADAA;font-size: 32rpx;font-weight: bold;" class="">
      <view class="" style="text-align: center;margin-top: 50%;">暂无活动</view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      list: [],
      shoopList: [],
      page: 1
    };
  },
  onShow() {
    this.init();
  },
  onReachBottom() {
    if (this.shoopList.length < this.page * 10) return;
    this.page++;
    this.init();
  },
  onShareAppMessage(res) {},
  methods: {
    toDetlis(item) {
      uni.navigateTo({
        url: '/pages/details/details?id=' + item.id
      });
    },
    async init() {
      let m = await this.$api.lists2({ page: 1 });

      this.list = m.data.banner;
      // this.shoopList = n.data.data;
      if (this.page != 1) {
        this.shoopList = [...this.shoopList, ...m.data.data];
      } else {
        this.shoopList = m.data.data;
      }
    }
  }
};
</script>

<style lang="scss">
* {
  box-sizing: border-box;
}
.shoop {
  display: flex;
  padding: 0 32rpx;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 34rpx;
  .shoop_son {
    width: 330rpx;
    margin-bottom: 32rpx;
    .price {
      text-align: center;
      .bt {
        margin-top: 16rpx;
        margin-bottom: 8rpx;
        font-size: 28rpx;
        font-family: PingFang SC-Regular, PingFang SC;
        font-weight: 400;
        color: #0a0a09;
      }
      .btPrice {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28rpx;
        font-family: PingFang SC-Bold, PingFang SC;
        font-weight: bold;
        color: #5c5a55;
        line-height: 48rpx;
      }
    }
  }
}
</style>
